package com.xn.app.muying.adpter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.xn.app.muying.R;
import com.xn.app.muying.activity.HealthRecordsHistoryActivity;
import com.xn.app.muying.util.APIMethod;

import java.util.ArrayList;

/**
 * Created by Administrator on 2017/5/19.
 */
public class HealthRecordsDateAdapter extends BaseAdapter {
    private Context context;
    private ArrayList<String> datas;
    private final LayoutInflater inflater;

    public HealthRecordsDateAdapter(Context context, ArrayList<String> datas) {
        this.context = context;
        this.datas = datas;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return datas.size();
    }

    @Override
    public Object getItem(int position) {
        return datas.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.healthrecordsdate_item, null);
            holder = new ViewHolder();
            holder.time = (TextView) convertView.findViewById(R.id.time);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.time.setText(datas.get(position));
        return convertView;
    }

    class ViewHolder {
        TextView time;
    }
}
